package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

import command.ICommand;

@SuppressWarnings("serial")
public class ChatMenuItem extends JMenuItem{
	
	public ChatMenuItem(String name, ICommand cmd) {
		super(name);
		this.addActionListener( new MListener(cmd) );
	}

	private class MListener implements ActionListener {
		protected ICommand cmd;
		
		public MListener(ICommand cmd)
		{
			this.cmd = cmd;
		}
		
		public void actionPerformed(ActionEvent e)
		{
			cmd.execute();
		}
	}
	
}
